<template>
	<view class="uni_box">
		<view class="newcontent">
			<!-- 头部 -->
			<Nheader :cont="cont" @leftClick="leftClick" @connectWallet="connectWallet" @gettantwo="gettantwo"></Nheader>
			<view class="content">
				<image class="honebg" src="/static/new/honebg.png" />
				<view class="duiview">
					<view class="duione">
						<view class="duiitem " :class="head==1?'dactive':''" @click="gethead(1)">
							<text class="dname"  >{{$t('i.兑换')}}</text>
							<view class="heng"></view>
						</view>
						<view class="duiitem" :class="head==2?'dactive':''" @click="gethead(2)">
							<text class="dname">{{$t('i.流动性')}}</text>
							<view class="heng"></view>
						</view>
					</view>
					<text class="kuaisu" v-if="head == 2">{{$t('i.快速添加BM流动性')}}</text>
					<view class="duitwo" v-if="status==1">
						<view class="uone">
							<view class="flex-row" @click="getqiebione()">
								<image class="usdt" src="/static/new/usdt.png" v-if="bitypeone==1" />
								<text class="uname" v-if="bitypeone==1">USDT</text>

								<image class="usdt" src="/static/new/logo.png" v-if="bitypeone==2"/>
								<text class="uname" v-if="bitypeone==2">BM</text>

								<image class="usdt" src="/static/new/bnb.webp" v-if="bitypeone==3"/>
								<text class="uname" v-if="bitypeone==3">BNB</text>
								<image class="xia" src="/static/new/xia.png" v-if="head==1" />
							</view>
							
							<text class="yue" v-if="bitypeone==1" >{{$t('i.余额')}}:{{usdBalance}}</text>
							<text class="yue" v-if="bitypeone==2" >{{$t('i.余额')}}:{{bmBalance}}</text>
							<text class="yue" v-if="bitypeone==3" >{{$t('i.余额')}}:{{bnbbal}}</text>
						</view>
						<view class="utwo">
							<u-input class="shuru" v-model="aboveinput" @input="changeinputone" input-align="right" type="text" :border="false" color="#fff" :placeholder="shuru"></u-input> 
							<view class="shubiao">
								<view class="bq" @click="upInAmount(25)" >25%</view>
								<view class="bq" @click="upInAmount(50)">50%</view>
								<view class="bq" @click="upInAmount(75)" >75%</view>
								<view class="bq" @click="upInAmount(100)" >100%</view>
							</view>
						</view>
					</view>
					<view class="duitwo" v-if="status==2">
						<view class="uone">
							<view class="flex-row">
								<image class="usdt" src="/static/new/usdt.png" v-if="bitypetwo==1" />
								<text class="uname" v-if="bitypetwo==1">USDT</text>

								<image class="usdt" src="/static/new/logo.png" v-if="bitypetwo==2" />
								<text class="uname" v-if="bitypetwo==2">BM</text>

								<image class="usdt" src="/static/new/bnb.webp" v-if="bitypetwo==3" />
								<text class="uname" v-if="bitypetwo==3">BNB</text>
							</view>
							
							<text class="yue" v-if="bitypetwo==1" >{{$t('i.余额')}}:{{usdBalance}}</text>
							<text class="yue" v-if="bitypetwo==2" >{{$t('i.余额')}}:{{bmBalance}}</text>
							<text class="yue" v-if="bitypetwo==3" >{{$t('i.余额')}}:{{bnbbal}}</text>
						</view>
						<view class="utwo">
							<u-input class="shuru" v-model="belowinput" @input="changeinputtwo" input-align="right" type="text" :border="false" color="#fff" :placeholder="shuru"></u-input> 
							<view class="shubiao">
								<view class="bq" v-for="(item,index) in 6" @click="downInAmount(index)" >{{index+1}}{{$t('i.枚')}}</view>
								<view class="bq" @click="downInAmount(7)" >{{status == 1?$t('i.买满'):$t('i.全卖')}}</view>
								
							</view>
						</view>
						<view class="jiaview">
							<text class="jianame">{{$t('i.价格')}}：1BM={{bmPrice}} USD</text>
							<text class="jianame ml">{{$t('i.锁')}}:{{lockedAmount}}</text>
						</view>
					</view>
					<view class="qieicon" v-if="head==1">
						<image class="qie" @click="getqie()" src="/static/new/qie.png" />
					</view>
					<view class="duitwo" v-if="status == 1">
						<view class="uone">
							<view class="flex-row">
								<image class="usdt" src="/static/new/usdt.png" v-if="bitypetwo==1" />
								<text class="uname" v-if="bitypetwo==1">USDT</text>

								<image class="usdt" src="/static/new/logo.png" v-if="bitypetwo==2" />
								<text class="uname" v-if="bitypetwo==2">BM</text>

								<image class="usdt" src="/static/new/bnb.webp" v-if="bitypetwo==3" />
								<text class="uname" v-if="bitypetwo==3">BNB</text>
							</view>
							<text class="yue" v-if="bitypetwo==1" >{{$t('i.余额')}}:{{usdBalance}}</text>
							<text class="yue" v-if="bitypetwo==2" >{{$t('i.余额')}}:{{bmBalance}}</text>
							<text class="yue" v-if="bitypetwo==3" >{{$t('i.余额')}}:{{bnbbal}}</text>
						</view>
						<view class="utwo">
							<u-input class="shuru" v-model="belowinput" @input="changeinputtwo" input-align="right" type="text" :border="false" color="#fff" :placeholder="shuru"></u-input> 
							<view class="shubiao">
								<view class="bq" v-for="(item,index) in 6"  @click="downInAmount(index)" >{{index+1}}{{$t('i.枚')}}</view>
								<view class="bq" @click="downInAmount(7)" >{{head == 1 ?$t('i.买满'): $t('i.加满')}}</view>
							</view>
						</view>
						<view class="jiaview">
							<text class="jianame">{{$t('i.价格')}}：1BM={{bmPrice}} USD</text>
							<text class="jianame ml">{{$t('i.锁')}}:{{lockedAmount}}</text>
						</view>
					</view>
					<view class="duitwo" v-if="status==2">
						<view class="uone">
							<view class="flex-row" @click="getqiebione()">
								<image class="usdt" src="/static/new/usdt.png" v-if="bitypeone==1" />
								<text class="uname" v-if="bitypeone==1">USDT</text>

								<image class="usdt" src="/static/new/logo.png" v-if="bitypeone==2"/>
								<text class="uname" v-if="bitypeone==2">BM</text>

								<image class="usdt" src="/static/new/bnb.webp" v-if="bitypeone==3"/>
								<text class="uname" v-if="bitypeone==3">BNB</text>
								<image class="xia" src="/static/new/xia.png" v-if="head==1" />
							</view>
							<text class="yue" v-if="bitypeone==1" >{{$t('i.余额')}}:{{usdBalance}}</text>
							<text class="yue" v-if="bitypeone==2" >{{$t('i.余额')}}:{{bmBalance}}</text>
							<text class="yue" v-if="bitypeone==3" >{{$t('i.余额')}}:{{bnbbal}}</text>
						</view>
						<view class="utwo">
							<u-input class="shuru" v-model="aboveinput" @input="changeinputone" input-align="right" type="text" :border="false" color="#fff" :placeholder="shuru"></u-input> 
							<view class="shubiao">
								<view class="bq"@click="upInAmount(25)">25%</view>
								<view class="bq"@click="upInAmount(50)">50%</view>
								<view class="bq"@click="upInAmount(75)">75%</view>
								<view class="bq"@click="upInAmount(100)">100%</view>
							</view>
						</view>
					</view>
					
				</view>
				<!-- <view class="jifen">
					<image class="qianbao" src="/static/new/qianbao.png" />
					<view class="jinav">
						<text class="jinum">{{user.points}}</text>
						<text class="jiname">{{$t('i.我的积分')}}</text>
					</view>
					<image class="ricon" src="/static/new/ricon.png" />
				</view> -->
				<view class="duihuan" @click="duihuan22()" >
					<view class="duibtn">{{head == 1?$t('i.兑换'):$t('i.加池子')}}</view>
				</view>
			</view>
		</view>

		<u-popup v-model="ubshow" mode="center" width="70%">
			<view class="yupop" v-if="ubshow">
				<view class="yuhead">
					<text class="qiehead">{{$t('i.代币类型')}}</text>
					<image class="cha" @click="ubshow=false" src="/static/new/cha.png" />
				</view>
				<view class="popitem "  style="margin-bottom: 20rpx;" @click="getqiebi(1)">
					<image class="gou" src="/static/new/usdt.png" />
					<text class="ptittwo">USDT</text>
				</view>
				<!-- <view class="popitem " style="margin-bottom: 20rpx;" @click="getqiebi(2)">
					<image class="gou" src="/static/new/logo.png" />
					<text class="ptittwo">BM</text>
				</view> -->
				<view class="popitem " style="margin-bottom: 20rpx;" @click="getqiebi(3)">
					<image class="gou" src="/static/new/bnb.webp" />
					<text class="ptittwo">BNB</text>
				</view>
				
			</view>
		</u-popup>
</view>
</template>

<script>

import { connectMetamask, mullcall, ADDRESS0,getAmountsOut,addPiarLiq, USDT,WBNB,bmaddr ,getReserve,sellToken, buyToken} from "@/utils/dapp.js"
import { defaultTo, path, take, takeLast } from "ramda"
import { DateTime } from 'luxon'
import tryCatch from "ramda/src/tryCatch"
import { ethers } from "ethers"
import Nheader from '@/components/Nheader/Nheader'
export default {
	data() {
		return {
			bgcolor: '#fff',
			checked: false,
			border: false,
			type: '1',
			show: false,
			keywords: '',
			list: [],
			hbg: '#0d0e0f',
			// cont: 'Connect Wallet',
			typeindex: 0,
			lp_amount:"",
			totalIn:0,
			alreadyPaid:0,
			in_percent:0,
			earned:0,
			iszhan: false,
			zhaninfo: {},
			applist: [],
			lshow: false,
			zshow: false,
			yuyan:'zh',
			status:1,
			head:1,
			ubshow:false,
			bitypeone:1,//1 usdt 2bm 3BNB
			bitypetwo:2,//1 usdt 2bm 3BNB
			type:1,//1点击上面 2点击下面
			aboveinput:'',//上面输入框 绑定
			belowinput:'',//下面输入框绑定
			bmBalance:'', 
			usdBalance:'', 
			usdapprRou:'',
			bmapprRou:'',
			usdappoeSk:'',
			bmappoeSk:'',
			reverseUSDT:'',
			reverseBM:'',
			bmPrice:'',
			lockedAmount:'',
			jiao:null,
			bnbbal:'',
			user:{
				point:0
			},
			cont:'',
			debounceTimer: null, // 防抖定时器
			debounceTimertwo: null // 防抖定时器
		}
	},
	components: {
		Nheader
	},
	computed: {
		shuru(){
			return this.$t('i.输入')
		}
	},

	mounted() {},
	async onLoad() {
		uni.setStorageSync('cont','')//清空地址 并链接钱包
		this.cont = ''
		this.connectWallet()
		this.refOnChainData()
		
		const url = new URL(window.location.href);
		const inviteCode = url.searchParams.get("i");
		if (inviteCode) {
			uni.setStorageSync('__inviter_____', inviteCode)
		}else{
			uni.removeStorageSync('__inviter_____');
		}
		
	},
	async onShow() {
		if(uni.getStorageSync('locale')){
			this.yuyan = uni.getStorageSync('locale')
		}
		 uni.setTabBarItem({
			index: 0,
			text: this.$t('i.首页')
		})
		uni.setTabBarItem({
			index: 1,
			text: this.$t('i.市值')
		})
		uni.setTabBarItem({
			index: 2,
			text: this.$t('i.权重榜')
		})
		if(uni.getStorageSync('cont')){
			this.cont = uni.getStorageSync('cont')
		}
		this.getjifen();//查询用户积分

	},
	onReachBottom: function () {
	},
	methods: {
		async refOnChainData() {
			const {bnbbal,bmBalance, usdBalance, usdapprRou,bmapprRou,usdappoeSk,bmappoeSk,reverseUSDT,reverseBM,lockedAmount} = await mullcall()
			this.bmBalance = bmBalance
			this.usdBalance = usdBalance
			this.usdapprRou = usdapprRou
			this.bmapprRou = bmapprRou
			this.usdappoeSk = usdappoeSk
			this.bmappoeSk = bmappoeSk
			this.bnbbal = bnbbal
			this.reverseUSDT = reverseUSDT
			this.reverseBM = reverseBM
			this.lockedAmount = lockedAmount
			this.bmPrice = (Number(reverseUSDT) / Number(reverseBM)).toFixed(2)
			// console.log({bnbbal,bmBalance, usdBalance, usdapprRou,bmapprRou,usdappoeSk,bmappoeSk})
		},
		async getjifen(){
			const address = await connectMetamask()
			let res = await this.$u.api.userpoints({address});
			console.log(res)
			this.user = res.user
		},
		typeClick(e) {
			this.type = e
		},
		async connectWallet() {
			const addr = await connectMetamask()
			console.log(addr)
			if (typeof addr === 'string') {
				this.cont = take(5, addr) + '...' + takeLast(3, addr) + ' '
				uni.setStorageSync('cont',this.cont)
			}
		},
		confirm(e) {
			console.log(e)
		},
		swchange(e) {
			console.log(e)
			if (!e) {
				this.bgcolor = '#fff'
			} else {
				this.bgcolor = '#0d0e0f'
			}
			console.log(bgcolor)
		},
		async typeClick1(item, index) {
			this.typeindex = index
			this.zhaninfo = item
			this.iszhan = false

			try {
				const chain_id = await window.ethereum.request({ method: "eth_chainId" })
				if (chain_id != item.chainid) {
					await window.ethereum.request({
						method: 'wallet_switchEthereumChain',
						params: [{ chainId: item.chainid }]
					});
				}
			} catch (e) {
				//TODO handle the exception
			}


		},
		leftClick() {
			console.log("+++")
			this.lshow = true
		},
		getyuyin(e) {
			this.yuyan = e
			this.switchLang(this.yuyan)
		},
		switchLang(e) {
			this.$i18n.locale = e
			// console.log(this.$i18n.locale)
			uni.setStorageSync('locale', e)
			this.zshow = false
			// this.$store.commit('getwen');
		},
		gettantwo(){
			if(!this.zshow){
				this.zshow = true 
			}else{
				this.zshow = false 
			}
			
		},
		getqie(){
			if(this.status == 1){
				this.status = 2
			}else if(this.status == 2){
				this.status = 1
			}
		},
		gethead(e){
			this.head = e
			this.status = 1
			if(this.head == 2){
				this.bitypeone = 1
			}
			this.aboveinput = ''
			this.belowinput= ''
			this.jiao= null
		},
		getqiebione(e){
			if(this.head == 1){//兑换才有
				this.ubshow = true
				this.type = 1
				this.aboveinput = ''
				this.belowinput= ''
			}
			
		},
		getqiebitwo(e){
			if(this.head == 1){
				this.ubshow = true
				this.type = 2
			}
			
		},
		getqiebi(e){
			if(this.type == 1){
				this.bitypeone = e
			}else if(this.type == 2){
				this.bitypetwo = e
			}
			this.ubshow = false
		},
		async upInAmount(_percent){
			if(this.head == 1){
				this.jiao = 'other'
				let amountin = 0;
				let aboveinput = 0;
				let cpath = []
				this.belowinput = ""
				if(this.bitypeone == 1){
					amountin = this.usdBalance
					cpath = [USDT, bmaddr]
				}else{
					amountin = this.bnbbal
					cpath = [WBNB, USDT, bmaddr]
				}
				if(_percent === 100){
					aboveinput = Number(amountin)
				}else{
					aboveinput = Number(amountin) * _percent / 100
				}
				this.aboveinput = aboveinput
				if(aboveinput > 0){
					const amountOut = await getAmountsOut(ethers.utils.parseEther(String(aboveinput)), cpath)
					const amountfor =  ethers.utils.formatEther(amountOut)
					this.belowinput = Math.min(amountfor, 7 - Number(this.bmBalance))
				}
			}else{
				let amountin = this.usdBalance;
				let aboveinput = 0;
				this.belowinput = ""				
				if(_percent === 100){
					aboveinput = Number(amountin)
				}else{
					aboveinput = Number(amountin) * _percent / 100
				}
				this.aboveinput = aboveinput
				if(aboveinput > 0){
					const resversess = await getReserve()
					this.belowinput = Number(aboveinput) * Number(resversess.reservebm) / Number(resversess.reserveusdt)
				}
			}
		},
		async downInAmount(count){
	
			if(this.head == 1){
					
				this.jiao = 'bm'
				let belowinput = 0
				if(this.status == 1){
						console.log({count})
					const _max = ethers.utils.parseEther('7')
					const bmbal = ethers.utils.parseEther(this.bmBalance || 0)
					if(bmbal.gte(_max)){
						this.belowinput = 0
						return
					}
					const remain = ethers.utils.formatEther(_max.sub(bmbal))
					belowinput = remain
				}else{
					if(count == 7){
						belowinput = Number(this.bmBalance) - Number(this.lockedAmount)
						console.log({belowinput})
						if(belowinput < 0.000001){
							this.belowinput = 0
							this.aboveinput = 0
							return 
						}
					}else{
						belowinput = count + 1
					}
				}
				this.belowinput = belowinput
				let cpath = []
				if(this.bitypeone == 1){
					cpath = [bmaddr, USDT]
				}else{
					cpath = [bmaddr, USDT, WBNB]
				}
				if(belowinput > 0){
					const amountOut = await getAmountsOut(ethers.utils.parseEther(String(belowinput)), cpath)
					const amountfor =  ethers.utils.formatEther(amountOut)
					this.aboveinput = amountfor
				}
			}else{
				let belowinput = count + 1
				if(count == 7){
					belowinput = this.bmBalance
				}
				this.belowinput = belowinput
				if(belowinput > 0){
					const resversess = await getReserve()
					this.aboveinput = Number(belowinput) * Number(resversess.reserveusdt) / Number(resversess.reservebm)
				}
			}
		},
		duihuan22(){
			console.log({jso:this.jiao, head: this.head})
			if(this.head == 2){
				const amountusdt = this.aboveinput
				const amountbm = this.belowinput
				if(Number(this.bmBalance) < Number(amountbm)){
					uni.showToast({
						title: "BM 余额不足",
						icon: 'error'
					})
					return
				}
				if(Number(this.usdBalance) < Number(amountusdt)){
					uni.showToast({
						title: "USDT 余额不足",
						icon: 'error'
					})
					return
				}
				this.addqiu(amountusdt, amountbm)
			}else{
				if(this.status == 1){
					//buy
					const aboveinput = this.aboveinput
					if(this.bitypeone ==1){
						if(Number(this.usdBalance) < Number(aboveinput)){
							uni.showToast({
								title: "USDT 余额不足",
								icon: 'error'
							})
							return
						}	
					}else{
						if(Number(this.bnbbal) < Number(aboveinput)){
							uni.showToast({
								title: "BNB 余额不足",
								icon: 'error'
							})
							return
						}
					}
					let parent = uni.getStorageSync('__inviter_____')
					if(!parent){
						parent = ADDRESS0
					}
					if(!ethers.utils.isAddress(parent)){
						parent =  ADDRESS0
					}
					this.buybm(aboveinput, this.belowinput, this.jiao, this.bitypeone ==1, parent)		
				}else{
					//sell
					const amountbm = this.belowinput
					if(Number(this.bmBalance) < Number(amountbm)){
						uni.showToast({
							title: "BM 余额不足",
							icon: 'error'
						})
						return
					}
					this.sellbm(amountbm, this.bitypeone ==1)
				}
			}
		},
		async buybm(amountIn, amountOut, jiaodian, isusd, parent) {
			uni.showLoading({title: 'loading...',mask: true})
			const result = await buyToken(String(amountIn),String(amountOut),jiaodian,isusd, this.usdappoeSk, parent)
				.catch(e=> {
					console.log(e)
					return ({error:true,msg:e.message})
				})
			 uni.hideLoading()
			if (result.error) {
				console.log(result)
				uni.showToast({
					title: "上链失败",
					icon: 'none'
				})
			} else {
				uni.showToast({
					title:  "上链成功",
					icon: 'success'
				})
			}
			this.refOnChainData()
		},
		async sellbm(amountbm, isusd) {
			uni.showLoading({title: 'loading...',mask: true})
			const result = await sellToken(String(amountbm),isusd, this.bmapprRou)
				.catch(e=> ({error:true,msg:e.message}))
			 uni.hideLoading()
			if (result.error) {
				console.log(result)
				uni.showToast({
					title: "上链失败",
					icon: 'none'
				})
			} else {
				uni.showToast({
					title:  "上链成功",
					icon: 'success'
				})
			}
			this.refOnChainData()
		},
		async addqiu(amountusdt, amountbm) {
			uni.showLoading({title: 'loading...',mask: true})
			const result = await addPiarLiq(String(amountusdt),String(amountbm), this.usdapprRou, this.bmapprRou)
				.catch(e=> ({error:true,msg:e.message}))
			 uni.hideLoading()
			if (result.error) {
				console.log(result)
				uni.showToast({
					title: '上链失败',
					icon: 'none'
				})
			} else {
				uni.showToast({
					title: "上链成功",
					icon: 'success'
				})
			}
			this.refOnChainData()
		},
		changeinputone(e){//输入上面输入框
			this.getjisuan(1,e)
		},
		changeinputtwo(e){//输入下面输入框
			this.getjisuan(2,e)
		},
		async getjisuan(type, e) {
			if (type == 1) {
				// 防抖核心：先清除上一次未执行的定时器
				clearTimeout(this.debounceTimer);
				this.belowinput = ""
				this.jiao = 'other'
				if(isNaN(parseFloat(e))) return
				if(parseFloat(e) === 0) return
				this.debounceTimer = setTimeout(async () => {
					// 此处添加接口请求参数（若需传aboveinput值，可在params中补充）	
					
					if(this.head == 1){
						let amountin = e;
						let cpath = []
						if(this.bitypeone == 1){
							cpath = [USDT, bmaddr]
						}else{
							cpath = [WBNB, USDT, bmaddr]
						}
						if(Number(amountin) > 0){
							const amountOut = await getAmountsOut(ethers.utils.parseEther(String(amountin)), cpath)
							const amountfor =  ethers.utils.formatEther(amountOut)
							this.belowinput = Math.min(amountfor, 7 - Number(this.bmBalance))
						}	
					}else{
						let aboveinput = e;			
						const resversess = await getReserve()
						this.belowinput = Number(aboveinput) * Number(resversess.reservebm) / Number(resversess.reserveusdt)
						
					}
				}, 500); // 500ms延迟，可按需调整（如300ms/600ms）
			} else if (type == 2) {
				// 输入下面计算上面：保持原逻辑
				clearTimeout(this.debounceTimertwo);
				this.aboveinput = ""
				this.jiao = 'bm'
				if(isNaN(parseFloat(e))) return
				if(parseFloat(e) === 0) return
				
				this.debounceTimertwo = setTimeout(async () => {
					if(this.head == 1){			
						const belowinput = e
						let cpath = []
						if(this.bitypeone == 1){
							cpath = [bmaddr, USDT]
						}else{
							cpath = [bmaddr, USDT, WBNB]
						}
						if(belowinput > 0){
							const amountOut = await getAmountsOut(ethers.utils.parseEther(String(belowinput)), cpath)
							const amountfor =  ethers.utils.formatEther(amountOut)
							this.aboveinput = amountfor
						}
					}else{
						let belowinput = e
						const resversess = await getReserve()
						this.aboveinput = Number(belowinput) * Number(resversess.reserveusdt) / Number(resversess.reservebm)
						
					}
					
				}, 500); // 500ms延迟，可按需调整（如300ms/600ms）
			}
		}



	}
}
</script>

<style lang="scss" scoped>
page,
html {}

.newcontent {
	min-height: 100vh;
	background-color: #22262F;
	.honebg{
		width: 100%;
		height: 300rpx;
		position: relative;
	}
	.duiview{
		margin: 20rpx;
		background: #2B313D;
		border-radius: 32rpx;
		.duione{
			display: flex;
			flex-direction: row;
			border-bottom: 2rpx solid #22262F;
			padding: 20rpx 0rpx 0;
			margin: 0 30rpx;
			.duiitem{
				min-width: 190rpx;
				display: flex;
				align-items: center;
				justify-content: center;
				position: relative;
				.dname{
					font-weight: bold;
					font-size: 32rpx;
					color: #828A99;
					display: inline-block;
					margin-bottom: 20rpx;
				}
				.heng{
					height: 8rpx;
					position: absolute;
					bottom: 0;
					left: 0;
					display: none;
					width: 100%;
					background: #39CC77;
					border-radius: 0px 0px 0px 0px;
				}
			}
			.dactive{
				.heng{
					display: inline-block;
				}
				.dname{
					color: #F8FAFC;
				}

			}
		}

		.duitwo{
			padding:40rpx 30rpx 40rpx;
			.uone{
				display: flex;
				flex-direction: row;
				align-items: center;
				.usdt{
					width: 48rpx;
					height: 48rpx;
					margin-right: 10rpx;
				}
				.uname{
					font-weight: 400;
					font-size: 32rpx;
					color: #F8FAFC;
				}
				.xia{
					width: 20rpx;
					height: 16rpx;
					margin-left: 10rpx;
					position: relative;
					top: 3rpx;
				}
				.yue{
					font-weight: 400;
					font-size: 24rpx;
					color: #828A99;
					margin-left: auto;
				}
			}
			.utwo{
				padding: 20rpx;
				border-radius: 32rpx;
				background: #22262F;
				margin-top: 20rpx;
				display: flex;
				flex-direction: column;
				.shuru{
					font-size: 30rpx;
					color: #fff;
				}
				/deep/.uni-input-input {
					color: #fff;
				}
				.shubiao{
					display: flex;
					flex-direction: row;
					align-items: center;
					justify-content: flex-end;
					margin-top: 6rpx;
					flex-wrap: wrap;
					.bq{
						padding: 2rpx 15rpx;
						border-radius: 50rpx;
						border: 2rpx solid #EEA933;
						margin-left: 10rpx;
						font-weight: 400;
						font-size: 24rpx;
						color: #EEA933;
						margin-bottom: 10rpx;
					}
				}
			}
			.jiaview{
				display: flex;
				margin-top: 20rpx;
				align-items: center;
				flex-direction: row;
				.jianame{
					font-weight: 400;
					font-size: 24rpx;
					color: #828A99;
				}
			}
			
		}
		.qieicon{
			display: flex;
			flex-direction: row;
			align-items: center;
			justify-content: center;
			.qie{
				width: 54rpx;
				height: 54rpx;
				
			}
		}
	}
	.duihuan{
		position: fixed;
		bottom: 100rpx;
		width: 100%;
		display: flex;
		// background-color: rgb(18, 26, 38);
		align-items: center;
		justify-content: center;
		padding: 20rpx 0;
		.duibtn{
			width: 90%;
			height: 88rpx;
			background: #39CC77;
			border-radius: 50rpx;
			display: flex;
			align-items: center;
			justify-content: center;
			font-weight: 400;
			font-size: 32rpx;
			color: #FFFFFF;

		}
	}
	.content{
		position: relative;
		padding-bottom: 230rpx;
	}
	.mban{
		width: 100%;
		height: 100%;
		// margin: -30px auto 0;
		position: absolute;
		top: 0;
		min-height: 100vh;

	}
	.twen{
		margin: 80rpx 50rpx 30rpx;
		.wentit{
			color: #fff;
			font-size: 28px;
			font-weight: 600;
			display: block;
			text-align: center;
		}
		.wenmiao{
			font-size: 12px;
			color: #fff;
			opacity: 0.5;
			font-weight: 400;
			display: block;
			text-align: center;
			margin: 30rpx 0 20rpx;
		}
		.adress{
			background-color: #FFFFFF1A;
			width: 100%;
			display: inline-block;
			align-items: center;
			text-align: center;
			justify-content: center;
			padding: 10rpx;
			border-radius: 4px;
			color: #fff;
			font-size: 12px;
			font-weight: 400;
			white-space: nowrap;
			/* 3. 隐藏超出容器的文本内容 */
			overflow: hidden;
			/* 4. 用省略号替代超出的文本 */
			text-overflow: ellipsis;
		}
	}
	.Frame2{
		width: 100%;
		height: 200px;
		position: relative;
	}
	.gouview{
		position: relative;
		display: flex;
		flex-direction: row;
		padding: 0 40rpx;
		margin-top: -63px;
		margin-bottom: 30rpx;
		.gouitem{
			width: 48%;
			height: 200px;
			background-color: rgba(255,255,255,0.1);
			border: 2px solid rgba(255,255,255,0.35);
			border-radius: 30rpx;
			position: relative;
			display: flex;
			flex-direction: column;
			padding: 30rpx;
			.dajie{
				font-size: 14px;
				color: rgba(255,255,255,0.75);
				display: block;
				margin-bottom: 4px;
			}
			.danum{
				color: #fff;
				font-size: 14px;
				font-weight: 400;
				.usdt{
					font-size: 28px;
					font-weight: 500;
					display: inline-block;
					margin-right: 6px;
				}
			}
			.rengou{
				margin-top: auto;
				width: 100%;
				background-color: rgba(255,255,255,0.1);
				border-radius: 10rpx;
				height: 32px;
				display: flex;
				align-items: center;
				justify-content: center;
				color: rgba(255,255,255,0.5);
			}
			.gou{
				background-color: #FFA100;
				color: #000;

			}
		}
		
	}
}
/deep/.u-mode-center-box{
	background-color: transparent;
}
.yupop{
	// width: 120px;
	// min-width: 140px;
	// position: absolute;
	// top: 58px;
	// right: 30rpx;
	// background-color: rgba(51, 51, 51, 0.802);
	// z-index: 100;
	// border-radius: 30rpx;
	// display: flex;
	// flex-direction: column;
	// padding: 10rpx 0;
	background: #1C222E;
	border-radius: 40rpx;
	padding: 40rpx;
	.yuhead{
		display: flex;
		flex-direction: row;
		align-items: center;
		margin-bottom: 40rpx;
		.qiehead{
			font-weight: 400;
			font-size: 32rpx;
			color: #FFFFFF;
		}
		.cha{
			margin-left: auto;
			width: 48rpx;
			height: 48rpx;
		}
	}
	.popitem{
		height: 40px;
		display: flex;
		flex-direction: row;
		align-items: center;
		padding: 0 20px;
		justify-content: center;
		position: relative;
		background: rgba(255,255,255,0);
		border-radius: 40rpx;
		border: 1px solid #FFFFFF;
		margin-bottom: 15rpx;
		.ptit{
			color: #fff;
			font-size: 30rpx;
			font-weight: 400;
			display: inline-block;
			width: 145rpx;
		}
		.ptittwo{
			color: #fff;
			font-size: 30rpx;
			font-weight: 400;
			display: inline-block;
			width: 80rpx;
		}
		.gou{
			width: 50rpx;
			height: 50rpx;
			margin-right: 20rpx;
		}
	}
	.pactive{
		background: #39CC77;
		border: 1px solid #39CC77;
		.gou{
			display: inline-block;
		}
		.ptit{
			color: #fff;
		}
	}
}

.kuaisu{
	font-weight: 500;
	font-size: 32rpx;
	color: #FFFFFF;
	display: block;
	margin: 30rpx 30rpx 0;
}
.jifen{
	display: flex;
	flex-direction: row;
	align-items: center;
	border: 2rpx solid #4D5461;
	padding: 30rpx;
	background: #22262F;
	border-radius: 20rpx;
	margin: 30rpx 20rpx;
	.jinav{
		display: flex;
		flex-direction: column;
	}
	.qianbao{
		width: 80rpx;
		height: 80rpx;
		margin-right: 20rpx;
	}
	.jiname{
		font-weight: 400;
		font-size: 24rpx;
		color: #828A99;
	}
	.jinum{
		font-weight: 400;
		font-size: 32rpx;
		color: #FFFFFF;
	}
	.ricon{
		margin-left: auto;
		width: 32rpx;
		height: 32rpx;
	}
}
.flex-row{
	display: flex;
	flex-direction: row;
	align-items: center;
}
</style>
